package handler;

import java.util.Map;

import com.hn.comm.excel.ExcelHandler;
import com.hn.comm.excel.ExcelModel;
import com.hn.shoutchinese.pinying.service.impl.PinyingServiceImpl;

public class PinyingHandler extends BaseHandler {
	public void startWork() {
		PinyingHandler ph = new PinyingHandler();

		PinyingServiceImpl ps = new PinyingServiceImpl();
		ExcelModel eModel = ExcelHandler.getExcelData(BaseHandler
				.getExcelFile());

		// 得到单个
		for (Map<String, String> map : eModel.getContent()) {
			// 得到拼音
			String pinying = map.get(HEAD_PINYING);
			pinying = pinying.trim();
			if (pinying == null || pinying.equals("null") || pinying.equals("")) {
				// 中文
				String pinyingChinese = ps.getPinying(map.get(HEAD_CHINESE));
				map.put(HEAD_PINYING, pinyingChinese);
			}
		}

		ExcelHandler.writeExcel(eModel, BaseHandler.getExcelFile());
		System.out.println("拼音转换完成。。。。。");
	}

	public static void main(String[] args) {
		PinyingHandler ph = new PinyingHandler();
		ph.startWork();
	}
}
